package com.yupi.yupibackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yupi.yupibackend.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yupi.yupibackend.model.req.user.UserAddRequest;
import com.yupi.yupibackend.model.req.user.UserLoginRequest;
import com.yupi.yupibackend.model.req.user.UserRegisterRequest;
import com.yupi.yupibackend.model.req.user.UserUpdateRequest;
import com.yupi.yupibackend.model.vo.UserVo;

import javax.servlet.http.HttpServletRequest;

/**
* @author 86178
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-05-03 19:41:39
*/
public interface UserService extends IService<User> {


    /**
     * 用户注册
     * @param userRegisterRequest
     * @return
     */
    Long userRegister(UserRegisterRequest userRegisterRequest);

    /**
     * 用户登录
     * @param userLoginRequest
     * @return
     */
    UserVo userLogin(UserLoginRequest userLoginRequest,HttpServletRequest request);

    /**
     * 用户更新
     * @param userUpdateRequest
     * @return
     */
    boolean userUpdate(UserUpdateRequest userUpdateRequest);

    /**
     * 用户登出
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);

    /**
     * 获取当前登录用户
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);


    /**
     * 获取加密后的密码
     * @param password
     * @return
     */
    String getEncryptPassword(String password);


    /**
     * 获取用户信息vo
     * @param user
     * @return
     */
    UserVo getUserVo(User user);


    /**
     * 判断是否为管理员
     * @param user
     * @return
     */
    boolean isAdmin(User user);

}
